package com.guagua.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.guagua.blog.entity.Article;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface ArticleMapper extends BaseMapper<Article> {

    int incrementViewCount(Long articleId);
    
    Article selectArticleDetail(Long id);
    
    IPage<Article> selectFavoriteArticles(Page<Article> page, @Param("userId") Long userId);
    
    IPage<Article> selectReadArticles(Page<Article> page, @Param("userId") Long userId);
    
    IPage<Article> selectLikedArticles(Page<Article> page, @Param("userId") Long userId);
    
    IPage<Article> selectArticlesByTag(Page<Article> page, @Param("tagId") Long tagId);

    /**
     * 获取用户的文章列表
     */
    IPage<Article> selectUserArticles(Page<Article> page, @Param("userId") Long userId);
} 